home *** CD-ROM | disk | FTP | other *** search
Text File | 1997-05-21 | 2.4 KB | 63 lines | [TEXT/CWIE] |
- // LDynamicPopupMenu.h
- // written by Constantine Spathis.
- // No rights reserved, use and abuse at will!
- // Thanks to the guys at Metrowerks who saved the Macintosh ( IMO :-) ) and to Greg Dow
- // for creating such a cranking piece of software. And of course to Ron Liechty
- // (hope I spelled that one correct) who must really be 10 guys from the way he
- // keeps ontop of answering questions.
- //
- //
- // This class facilitates the creation of true(?) dynamic Pop-up menus within the
- // powerplant framework. The implementation is fairly straightforward, kill the control
- // powerplant creates and create our own with the menuID mMenuID (making sure to
- // increment it). Please let me know of any improvements you make and any bugs you might
- // find.
- //
- // 1/8/95 CS Initial Iteration
- // 97/05/20 P. Lamboley
- // I cannot read code if it's not presented my way, but the general idea is unchanged.
- // The whole menu is now taken from the original, including disabled items aso : it
- // avoids having to reconstruct it from scratch in the code. This is not done if a
- // resource list has been specified in Constructor (PPob) : the menu items are added
- // automatically when the control is created.
- // The following are LOST from the PPob, because hidden in the undocumented part of
- // the ControlHandle. They can be set explicitely with the class behavior calls :
- // * title justification (mValue for NewControl).
- // Defaults to popupTitleRightJust.
- // Valid values are : enum { popupTitleLeftJust = 0x00000000,
- // popupTitleCenterJust = 0x00000001,
- // popupTitleRightJust = 0x000000FF };
- // * width of title (mMaxValue for NewControl)
- // Defaults to 0 (can't see the title)
- // Specifie a negative value to evaluate the width of the title at runtime
-
- #include <LStdControl.h>
-
- class LDynamicPopupMenu : public LStdPopupMenu {
-
- public:
-
- // Class ID Enumeration see Scott Meyers, Effective C++.
- enum {
- class_ID = 'LDPM',
- first_menu_ID = 20000
- };
-
- /* ctor */ LDynamicPopupMenu (LStream*);
- static LDynamicPopupMenu* CreateLDynamicPopupMenuStream (LStream*);
-
- // Set class behavior
- void SetTitleWidth (Int16);
- void SetTitleJust (Int16);
-
- // Call this when you're done modifying things into the menu
- void FinishedCreatingMenu (Int32 initial_item);
-
- private:
-
- static Int16 mTitleWidth;
- static Int16 mTitleJust;
- static Int16 mMenuID;
-
- };
-